package cn.t222.ch02;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class HelloController {
    @Autowired
    private User user;
    @Autowired
    private Book book;

    @GetMapping("")
    public String hello() {
        return "hello spring boot";
    }
    @GetMapping("/book")
    public Book book() {
        return book;
    }

    @GetMapping("/user")
    public User user() {
        log.debug("进入了/user控制器: {}", user);
        return user;
    }
}
